<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="../../style/css/style.css" rel="stylesheet" type="text/css" />
    <script src="../../style/js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
          f();
        });

        function f() {
            $.get("../../web/Web",function (res){
                if (res==201){
                    window.parent.location.replace("../login.html");
                }else if (res==500){
                    alert("服务器忙碌list");
                }else {

                    var str1=" ";
                    for (i=0;i<res.data.length;i++){
                        var  imgsrc ="http://127.0.0.1:8080/UploadImg/logoImgSrc/"+res.data[i].newFileName;
                        str1+="<tr align ='center'>";
                        str1+="<td>"+(i+1)+"</td>";
                        str1+="<td>"+res.data[i].title+"</td>";
                        // str1+="<td>"+res.data[i].logoImgSrc+"</td>";
                        if(res.data[i].newFileName==null||res.data[i].newFileName==undefined){
                            str1 += "<td>未上传logo</td>";
                        }else{
                            str1 += "<td><img src='"+imgsrc+"' width='50px' height='50px'></td>";
                        }

                        str1+="<td>"+res.data[i].recordation+"</td>";
                        str1+="<td>"+res.data[i].companyName+"</td>";
                        str1+="<td>"+res.data[i].tel+"</td>";
                        str1+="<td><a href='javaScript:void(0)' onclick='updateId("+res.data[i].id+")'>修改</a>"+
                            "<a href='javaScript:void(0)' onclick='del("+res.data[i].id+")'>删除</a></td>";
                        str1+="</tr>";
                    }
                    $("#tableId").append(str1);
                }
                console.log(res);
            },"json");
        }
        //删除网站信息
        function del(id){
            alert(id);
            if (confirm("您确定删除吗")){
                $.get("../../web/delete",{id:id},function (res) {
                    if (res.code==201){
                        alert("删除成功");
                        location.reload();
                    }else if (res.code==200){
                        alert("删除失败");
                        location.replace("../login.html");
                    }
                    else {
                        alert("服务器忙!!");
                    }
                });
            }
        }
        //修改网站信息
        function updateId(id) {
            location.assign("update.html?id="+id);
        }
    </script>
</head>

<body>
<div class="rightinfo">
    <!-- 顶部按钮 -->
    <div class="tools">
        <ul class="toolbar">
            <a href="add.html">
                <li class="click">
                    <span><img src="../../style/img/adminMainPicture/t01.png" /></span>
                    添加
                </li>
            </a>
        </ul>
    </div>
    <!--数据列表 -->
    <form >
        <table class="tablelist" id="tableId">
            <th>编号<i class="sort"><img src="../../style/img/adminMainPicture/px.gif" /></i></th>
            <th>网站标题名称</th>
            <th>logo链接</th>
            <th>网站备案号</th>
            <th>公司名称</th>
            <th>联系方式</th>
            <th>其他操作</th>

        </table>
    </form>
</div>
</body>
</html>
